function path = A_star_search(map, MAX_X, MAX_Y)
    % This part is about map/obstacle/and other settings

    % pre-process the grid map, add offset
    size_map = size(map, 1);

    % Define the 2D grid map array.
    % Obstacle = -1, Target = 0, Start/Free = 1
    MAP = 2 * (ones(MAX_X, MAX_Y));

    % Initialize MAP with location of the target
    xval = floor(map(size_map, 1));
    yval = floor(map(size_map, 2));
    xTarget = xval;
    yTarget = yval;
    MAP(xval, yval) = 0;

    % Initialize MAP with location of the obstacle
    for i = 2:size_map - 1
        xval = floor(map(i, 1));
        yval = floor(map(i, 2));
        MAP(xval, yval) = -1;
    end

    % Initialize MAP with location of the start point
    xval = floor(map(1, 1));
    yval = floor(map(1, 2));
    xStart = xval;
    yStart = yval;
    MAP(xStart, yStart) = 1;

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    % LISTS USED FOR ALGORITHM
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    % OPEN LIST STRUCTURE
    %------------------------------------------------------------------------------------
    % IS ON LIST 1/0 | X val | Y val | Parent X val | Parent Y val | h(n) | g(n) | f(n) |
    %------------------------------------------------------------------------------------
    OPEN = [];
    % CLOSED LIST STRUCTURE
    %----------------
    % X val | Y val |
    %----------------
    CLOSED = [];

    % Put all obstacles on the Closed list
    k = 1; % Dummy counter

    for i = 1:MAX_X

        for j = 1:MAX_Y

            if (MAP(i, j) == -1)
                CLOSED(k, 1) = i;
                CLOSED(k, 2) = j;
                k = k + 1;
            end

        end

    end

    CLOSED_COUNT = size(CLOSED, 1);

    % set the starting node as the first node
    xNode = xStart;
    yNode = yStart;
    OPEN_COUNT = 1;
    hn = distance(xNode, yNode, xTarget, yTarget);
    gn = 0;
    OPEN(OPEN_COUNT, :) = insert_open(xNode, yNode, xNode, yNode, hn, gn, hn + gn);

    % has path flag
    hasPath = 1;

    %% This part is your homework
    %%%%%%%%%%%%%%%%%%
    % START ALGORITHM
    %%%%%%%%%%%%%%%%%%
    while (0) % you have to dicide the Conditions for while loop exit

        %
        % finish the while loop
        %

    end % End of While Loop

    % Once algorithm has run The optimal path is generated by starting of at the
    % last node(if it is the target node) and then identifying its parent node
    % until it reaches the start node. This is the optimal path

    %
    % How to get the optimal path after A_star search?
    % please finish it
    %

    path = [];

end
